using complex.Services;
using NHibernate;
using StructureMap.Configuration.DSL;

namespace complex.Registries
{
    public class NhibernateRegistry
        : Registry
    {
        public NhibernateRegistry()
        {
            var factory = NhibernateConfigurationFactory.CreateFactory();

            For<ISessionFactory>().Singleton().Use(factory);
            For<ISession>().Use(context => context.GetInstance<ISessionFactory>().OpenSession());
        }
    }
}